package com.flydog.taskManager.repository;

import com.flydog.taskManager.entity.PeriodicTask;
import com.flydog.taskManager.entity.PhasedTask;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.Calendar;
import java.util.List;

public interface PeriodicTaskRepository extends JpaRepository<PeriodicTask, Long>, JpaSpecificationExecutor<PeriodicTask> {
    List<PeriodicTask> findByUserId(Long userId);

    List<PeriodicTask> findDistinctByPeriodEndTimeLessThanEqual(Calendar periodEndTime);

    List<PeriodicTask> findByPeriodEndTimeBetweenAndUserIdOrderByPeriodEndTimeDesc(Calendar periodEndTimeStart, Calendar periodEndTimeEnd, Long userId);

    int countByPeriodEndTimeBetweenAndUserId(Calendar periodEndTimeStart, Calendar periodEndTimeEnd, Long userId);




}